package com.warrior.util;

import java.util.Objects;

/**
 * 一些简单的工具类
 * Created by Shawn on 2017/3/28.
 */
public class CommonUtils {

    //声明构造方法
    public CommonUtils() {
    }

    /**
     * object转int
     * @param o 待转值
     * @return
     */
    public static int Object2Int(Objects o) {
        int v = 0;
        if (o != null) {
            v = Integer.parseInt(o.toString());
        }
        return v;
    }

    public static int String2Int(String s){
        int v = 0;
        if (s != null) {
            v = Integer.parseInt(s);
        }
        return v;
    }

    /**
     * 过滤emoji表情
     * @param str
     * @return
     */
    public static String removeNonBmpUnicode(String str) {
        if (str == null) {
            return null;
        }
        str = str.replaceAll("[^\\u0000-\\uFFFF]", "");
        return str;
    }




}